<!-- tabbar:采样: sampling -->
<template>
	<view class="index-body">
		<view style="padding: 20px;">
			<u-button type="primary" :plain="true" text="拍照" @click="paizhao"></u-button>
		</view>
		<view style="padding: 20px;">
			<u-button type="primary" :plain="true" text="扫码" @click="saoma"></u-button>
		</view>
	</view>
</template>

<script>
	export default {
		components: {},
		data() {
			return {}
		},
		methods: {
			paizhao() {
				console.log('拍照');
				uni.chooseImage({
					success: function(res) {
						console.log(JSON.stringify(res.tempFilePaths));
					}
				});
			},
			saoma() {
				console.log('扫码');
				// 允许从相机和相册扫码
				uni.scanCode({
					scanType: ['barCode'], // 调起条码扫描
					success: function(res) {
						console.log('条码类型：' + res.scanType);
						console.log('条码内容：' + res.result);
					}
				});
			},
		},
	}
</script>

<style lang="scss" scoped>
	.index-body {
		height: calc(100vh - 170rpx);
		overflow: hidden;

		.tabs-input-con {
			padding: $padding-sm $padding-lg;
		}

		.content {
			max-height: 100vh;
			padding: 0 $padding-lg $padding-lg $padding-lg;

			.tag-text-red {
				color: white;
				background-color: $uni-color-error;
				border-radius: $padding-lg;
				padding: 0 $padding-sm;
			}
		}
	}
</style>